/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.meteocal.boundary;

import it.polimi.meteocal.control.UserManager;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

@Named
@RequestScoped
public class UserBean {

    @EJB
    UserManager um;

    public UserBean() {

    }

    public String getName() {
        return um.getLoggedUser().getName() + " " + um.getLoggedUser().getSurname();
    }

    /**
     *
     * @return the textual rappresentation of the visibility of the calendar
     */
    public String getVisibility() {
        if (um.getLoggedUser().getPublicCalendar()) {
            return "PUBLIC";
        } else {
            return "PRIVATE";
        }
    }

    public void changeVisibility() {
        um.changeVisibility();
    }
}
